package com.haoting.mamba.team.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.haoting.mamba.team.entity.TeamSupportsEntity;
import com.haoting.mamba.team.service.TeamSupportsService;
import com.haoting.common.utils.PageUtils;
import com.haoting.common.utils.R;



/**
 * 
 *
 * @author tanghao
 * @email 767417609@qq.com
 * @date 2021-03-14 21:09:05
 */
@RestController
@RequestMapping("team/teamsupports")
public class TeamSupportsController {
    @Autowired
    private TeamSupportsService teamSupportsService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = teamSupportsService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{userId}")
    public R info(@PathVariable("userId") String userId){
		TeamSupportsEntity teamSupports = teamSupportsService.getById(userId);

        return R.ok().put("teamSupports", teamSupports);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody TeamSupportsEntity teamSupports){
		teamSupportsService.save(teamSupports);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody TeamSupportsEntity teamSupports){
		teamSupportsService.updateById(teamSupports);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody String[] userIds){
		teamSupportsService.removeByIds(Arrays.asList(userIds));

        return R.ok();
    }

}
